package com.yn.service.zy.model.dto;

import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yn.common.constants.Constants;
import com.yn.common.enums.OrganTypeEnum;
import com.yn.common.model.zy.TOrganInfoDO;
import com.yn.common.utils.BeanUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.ObjectUtils;

import java.util.Date;

/**
 * @ClassName: TOrganInfoDTO
 * @Description:
 * @Author: lxp
 * @Date: 2025/5/7 16:11
 **/
@Data
@ApiModel("机构信息出参")
public class TOrganInfoDTO {

    @ApiModelProperty("主键id")
    private Integer id;

    @ApiModelProperty("结构名称")
    private String organName;

    @ApiModelProperty("机构简介")
    private String organIntro;

    @ApiModelProperty("机构图片")
    private String organImageUrl;

    @ApiModelProperty("机构类型(1:医院 2:康复3:养老机构)")
    private String organType;

    @ApiModelProperty("机构类型字符串")
    private String organTypeStr;

    @ApiModelProperty("机构特色")
    private String organFeature;

    @ApiModelProperty("收费")
    private Integer price;

    @ApiModelProperty("收费单位(年/月)")
    private String unit;

    @ApiModelProperty("单位字典值")
    private String unitStr;

    @ApiModelProperty("设备")
    private String deviceInfo;

    @ApiModelProperty("区域编码")
    private String regionCode;

    @ApiModelProperty("详细地址")
    private String regionDetailInfo;

    @ApiModelProperty("修改人")
    private Integer updateId;

    @JsonFormat(pattern = Constants.DATE_FORMAT)
    @ApiModelProperty("创建时间")
    private Date createTime;

    public static TOrganInfoDTO transform(TOrganInfoDO tOrganInfoDO){
        if (ObjectUtils.isEmpty(tOrganInfoDO)) {
            return null;
        }

        TOrganInfoDTO tOrganInfoDTO = BeanUtils.copyProperties(tOrganInfoDO, TOrganInfoDTO.class);
        tOrganInfoDTO.setOrganTypeStr(OrganTypeEnum.getByCode(tOrganInfoDTO.getOrganType()).getName());
        return tOrganInfoDTO;
    }
}
